<template>
  <div>
    <comment-list type='user'
                  :comments='comments'></comment-list>
  </div>
</template>


<script>
import { get } from '@/utils'
import CommentList from '@/components/CommentList'
export default {
  data () {
    return {
      userInfo: {},
      comments: []
    }
  },
  methods: {
    init () {
      wx.showNavigationBarLoading()
      this.getComments()
      // this.getBooks()
      wx.hideNavigationBarLoading()
    },
    async getComments () {
      const commentList = await get('/weapp/commentList', {
        openid: this.userInfo.openId
      })
      console.log(commentList)
      this.comments = commentList.list
    }
  },
  onShow () {
    this.userInfo = wx.getStorageSync('userInfo')

    this.init()
  },
  components: {
    CommentList
  }
}
</script>

<style></style>
